﻿
using System.Windows;

namespace Patterns4Net.ArchitectureExplorer.Views.Utils
{
    using System;
    using System.Globalization;
    using System.Windows.Data;

    public class TrueToCollapsedConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool && (bool)value)
            {
                return Visibility.Collapsed;
            }

            return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Visibility && (Visibility)value == Visibility.Collapsed)
            {
                return true;
            }

            return false;
        }
    }
}
